<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="huoyun" uri="/huoyun"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>我的应标</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">

<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/theme/css/dialog.css">
<script type="text/javascript"
	src="${pageContext.request.contextPath}/theme/js/dialog.js"></script>
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/theme/css/main.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/theme/css/style_userCenter.css">
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/car/css/cars-cx.css">
<script type="text/javascript"
	src="${pageContext.request.contextPath}/theme/js/jquery-1.6.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/car/js/jweather-by-chengxin.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/car/js/car-tzh.js"></script>
<script type="text/javascript">
	function add_event(tr){
		tr.onmouseover = function(){
			tr.className += ' hover';
		};
		tr.onmouseout = function(){
			tr.className = tr.className.replace(' hover', '');
		};
	}

	function stripe(table) {
		var trs = table.getElementsByTagName("tr");
		for(var i=1; i<trs.length; i++){
			var tr = trs[i];
			tr.className = i%2 != 0? 'odd' : 'even';
			add_event(tr);
		}
	}
	
	/* 弹出框：
		type=bid: 显示单个货物的所有应标信息
		type=detail: 显示单个货物的详细信息
	 */
	function openDialog(goodsId, type)
    {
    	if(type == 'bid') {
    		var urlStr = "/huoyun/cargo/getAllBiddingCars.action?goodsId="+goodsId;
    		new Dialog({type:'url', value:urlStr}, {fixed:false}, {title:'详细应标信息'}).show();
    	}
    	else if (type == 'detail') {
    		var urlStr = "/huoyun/cargo/getCargoDetailForCar.action?goodsId="+goodsId;
    		new Dialog({type:'url', value:urlStr}, {fixed:false}, {title:'详细货物信息'}).show();
    	}
    	
    }
    
    /*
		弹出窗：应标后出价
	*/
	function openDialog2()
    {
    	new Dialog('暂不可用').show();
    }

	window.onload = function(){
		var table = document.getElementById('my_registed_cars_table');
		stripe(table);
	}
	
	/*
		弹出窗：显示货主留言信息
	*/
	function openOtherInfoDialog(otherInfo)
	{
		new Dialog(otherInfo, {fixed:false}, {title:'货主留言'}).show();
	}
</script>

<style type="text/css">
#submit_button {
	width: 100px;
	height: 40px;
	background-image:
		url("${pageContext.request.contextPath}/theme/images/button_normal.png");
	background-size: 100% 100%;
	border: none;
	cursor: pointer;
	font-family: 宋体;
	font-size: 18px;
	font-style: normal;
	color: #fff;
	font-weight: bold;
	background-image:
		url("${pageContext.request.contextPath}/theme/images/button_normal_ie.png")
		\9;
}

#submit_button:hover,#submit_button.hover {
	background-image:
		url("${pageContext.request.contextPath}/theme/images/button_hover.png");
	background-image:
		url("${pageContext.request.contextPath}/theme/images/button_hover_ie.png")
		\9;
}

#submit_button:active,#submit_button.active {
	background-image:
		url("${pageContext.request.contextPath}/theme/images/button_down.png");
	background-image:
		url("${pageContext.request.contextPath}/theme/images/button_down_ie.png")
		\9;
}
</style>
</head>

<body>
	<div>
		<jsp:include page="../userAdmin/nav.jsp">
			<jsp:param value="nav_main" name="nav" />
		</jsp:include>
	</div>
	<div class="realCer">

		<!--主体部分-->
		<div class="realMain clearfix mt10">
			<!--左侧菜单-->
			<div class="realLeft" id="meunLeft">
				<jsp:include page="../userAdmin/leftMenu.jsp">
					<jsp:param value="con_nav_main" name="con_nav" />
					<jsp:param value="showMyBiddedGoods" name="selectMenu"/>
				</jsp:include>
			</div>
			<!--中间-->
			<div class="realRight ml10">
				<!--中间-->
				<div class="realR_left">
					<div class="box" style="width:805px;">
						<div class="tit">
							<strong>车辆管理</strong>
						</div>
						<div class="con">
							<div id="my_bidded_goods_div" class="form_wrap clearfix">
								<form id="my_bidding_goods_form" method="post">
									<p>
										<font size="4" color="red">我正参与的应标/竞标（等待货主选标）</font>
									</p>
									<table id="my_bidded_goods_table">
										<tr style="background-color: silver;">
											<th>序号</th>
											<th>车牌号</th>
											<th>货物类型</th>
											<th>数量</th>
											<th>货主报价</th>
											<th>我的出价</th>
											<th>应标人数</th>
											<th>详细信息</th>
											<th>退标</th>
										</tr>
										<s:iterator value="myBiddingInfoList" id="biddingInfo"
											status="st">
											<tr>
												<td><s:property value="#st.index+1"/></td>
												<td>
													<s:property value="#biddingInfo.car.cardNumber" />
												</td>
												<td>
													<huoyun:customSelect mode="cargoPackageType" value="${biddingInfo.cargoInfo.type }" type="view"/>
												</td>
												<td>
													<s:property value="#biddingInfo.cargoInfo.amount" />
													<huoyun:customSelect mode="measureType" value="${biddingInfo.cargoInfo.measure }" type="view"/>
												</td>
												<td><font size="2">&yen;</font><s:property value="#biddingInfo.cargoInfo.freight" />元
												</td>
												<td><font size="2" color="red">&yen;<s:property value="#biddingInfo.bidInfo.price" />元</font>
												</td>
												<td><a href="" onclick="openDialog(<s:property value="#biddingInfo.cargoInfo.id"/>,'bid'); return false;"><s:property value="#biddingInfo.biddingCarCount" />人应标该货物</a>
												</td>
												<td><a href="" onclick="openDialog(<s:property value="#biddingInfo.cargoInfo.id"/>,'detail'); return false;">详细信息</a>
												</td>
												<td><input type="button" value="退标"
													onclick="if(confirm('确定要退标吗？')){this.form.action='/huoyun/car/deleteBidInfo.action?bidInfoId=<s:property value="#biddingInfo.bidInfo.id"/>'; this.form.submit();}" />
												</td>
											</tr>
										</s:iterator>
									</table>
								</form>
								<br>
								<form id="my_invited_bid_form" method="post">
									<p>
										<font size="4" color="blue">货主邀请的应标/竞标（等待我确认）</font>
									</p>
									<table id="my_bidded_goods_table">
										<tr style="background-color: silver;">
											<th>序号</th>
											<th>车牌号</th>
											<th>货物类型</th>
											<th>吨位</th>
											<th>运输总价</th>
											<th>货主留言</th>
											<th>货物详细信息</th>
											<th>确认</th>
										</tr>
										<s:iterator value="myInviteCarModelList" id="inviteCarModel"
											status="st">
											<tr>
												<td><s:property value="#st.index+1"/> </td>
												<td><s:property value="#inviteCarModel.car.cardNumber" />
												</td>
												<td><huoyun:customSelect mode="cargosType" value="${inviteCarModel.cargoInfo.type }" type="view"/>
												</td>
												<td>
													<s:property value="#inviteCarModel.cargoInfo.amount" /><huoyun:customSelect mode="measureType" value="${inviteCarModel.cargoInfo.measure }" type="view"/>
												</td>
												<td><font size="2">&yen;</font><s:property value="#inviteCarModel.inviteCar.price" />元</td>
												<td>
													<a href="" onclick="openOtherInfoDialog('<s:property value="#inviteCarModel.inviteCar.otherInfo"/>'); return false;">查看留言</a>
												</td>
												<td><a href="" onclick="openDialog(<s:property value="#inviteCarModel.cargoInfo.id"/>,'detail'); return false;">详细信息</a>
												</td>
												<td>
													<button onclick="if(confirm('确定要应标吗？')){this.form.action='/huoyun/car/acceptInvitedBid.action?goodsId=${inviteCarModel.cargoInfo.id}&carId=${inviteCarModel.car.id}&inviteCarId=${inviteCarModel.inviteCar.id}&price=${inviteCarModel.cargoInfo.freight}'; this.form.submit(); return true;} else return false;">应标</button>
												</td>
											</tr>
										</s:iterator>
									</table>
								</form>
								<br>
								<p>
									<font size="4" color="gray">已经达成的交易</font>
								</p>
								<table id="my_bidded_goods_table">
									<tr style="background-color: silver;">
										<th>序号</th>
										<th>车牌号</th>
										<th>货物类型</th>
										<th>吨位</th>
										<th>成交价格</th>
										<th>详细信息</th>
									</tr>
									<s:iterator value="mySuccessBidInfoList" id="successBidInfo"
										status="st">
										<tr>
											<td><s:property value="#st.index+1"/> </td>
											<td><s:property value="#successBidInfo.car.cardNumber" />
											</td>
											<td><huoyun:customSelect mode="cargosType" value="${successBidInfo.cargoInfo.type }" type="view"/>
											</td>
											<td><s:property value="#successBidInfo.cargoInfo.amount" />
												<huoyun:customSelect mode="measure" value="${successBidInfo.cargoInfo.measure }" type="view"/>
											</td>
											<td><font size="2">&yen;</font><s:property value="#successBidInfo.bidInfo.price" />元</td>
											<td><a href=""
												onclick="openDialog(<s:property value="#successBidInfo.cargoInfo.id"/>,'detail'); return false;">详细信息</a>
											</td>
										</tr>
									</s:iterator>
								</table>
							</div>
						</div>
					</div>
				</div>
				<!-- 中间 -->
			</div>
			<!--中由-->
		</div>
	</div>
	<div>
		<jsp:include page="../footer.jsp"></jsp:include>
	</div>
</body>
</html>
